"""
URL configuration for DjangoProject1 project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include, re_path
from django.conf import settings
from django.views.static import serve

# 关于simplejwttoken包的导入
from rest_framework_simplejwt.views import (
    TokenObtainPairView,  # 获取令牌（包含 access 和 refresh）
    TokenRefreshView,    # 刷新令牌（用 refresh 获取新的 access）
    TokenVerifyView,     # 验证令牌有效性
)

urlpatterns = [
    path('admin/', admin.site.urls),
    re_path(r'uploads/(?P<path>.*)', serve, {'document_root': settings.MEDIA_ROOT}),
    path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    path('api/token/verify/', TokenVerifyView.as_view(), name='token_verify'),
    path('api/v1/', include('user.urls')),
    path('api/v1/', include('course.urls')),
    path('api/v1/', include('game.urls')),
    path('api/v1/', include('message.urls')),
    path('home/', include('home.urls')),
    path('user/', include('superuser.urls')),
    path('ckeditor', include('ckeditor_uploader.urls')),
    path('course/', include('courses.urls')),
    path('search/', include('search.urls')),
    path('cart/', include('majing.urls')),
    path('api/v1/', include('cart.urls')),
    path('order/', include('order.urls')),
    path('pay/', include('payments.urls')),
    path('api/', include('day18.urls')),
    path('ks/', include('ks.urls')),
    path('ks2/', include('homes.urls')),
    path('ks1/', include('goods.urls')),
]
